package com.sas.hnn;

import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.ToggleButton;

public class MyDialogFragment extends DialogFragment {

	private final String TAG = MyDialogFragment.class.getSimpleName();

	String mFrau;

	static MyDialogFragment newInstance(String fProp) {
		MyDialogFragment f = new MyDialogFragment();

		Bundle args = new Bundle();
		args.putString("frau", fProp);
		f.setArguments(args);

		return f;
	}

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		mFrau = getArguments().getString("frau");

		setStyle(DialogFragment.STYLE_NO_TITLE,
				android.R.style.Theme_Holo_Dialog);
		/*
		 * andere Themen: android.R.style.Theme_Holo_Light_Dialog; break;
		 * android.R.style.Theme_Holo_Light; break;
		 * android.R.style.Theme_Holo_Light_Panel; break;
		 * android.R.style.Theme_Holo_Light; break;
		 */

	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v = inflater.inflate(R.layout.fragment_dialog, container, false);
		View tv = v.findViewById(R.id.text);
		((TextView) tv).setText("Du denkst also Frauen sind " + mFrau);

		// Watch for button clicks.
		Button button = (Button) v.findViewById(R.id.show);
		button.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				FragmentTransaction ft = getFragmentManager()
						.beginTransaction();
				Fragment prev = getFragmentManager()
						.findFragmentByTag("dialog");
				Log.d(TAG, "remove");
				dismiss();

			}
		});

		return v;
	}

}